using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Services.Activity.Domain.Entities;

namespace Services.Activity.Infrastructure.Configs;
public class ActivityVolunteerConfig : IEntityTypeConfiguration<ActivityVolunteer>
{
    public void Configure(EntityTypeBuilder<ActivityVolunteer> builder)
    {
        builder.ToTable("T_ActivityVolunteer");
        builder.HasKey(x => x.Id);
        builder.Property(x => x.Id).UseHiLo();
        builder.Property(x => x.ActivityId).IsRequired();
        builder.Property(x => x.VolunteerId).IsRequired();
        builder.HasQueryFilter(x => x.IsDeparted == false);
    }
}